import { configureStore } from '@reduxjs/toolkit'
import adminReducer from './adminSlice'
import commonReducer from './commonSlice'

import { persistStore,persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'

const persistConfig = {
    key:'root',
    storage: storage , 
}
const PersistedAdminReducer = persistReducer(persistConfig, adminReducer);
const PersistedCommonReducer = persistReducer(persistConfig,commonReducer);
const store = configureStore({
    reducer:{
        admin:PersistedAdminReducer,
        common:PersistedCommonReducer,
    }
})

export default store;
export const persistor = persistStore(store)